import Vue from "vue";
import Vuex from "vuex";
import pathify, { make } from "vuex-pathify";
import { DefaultAppState, IAppState } from "@/model/AppState";

Vue.use(Vuex);

// 配置pathify插件
pathify.options.strict = true;
pathify.options.mapping = "simple";

const state: IAppState = new DefaultAppState();
const mutations = make.mutations(state);

const actions = make.actions(state);

const store = new Vuex.Store({
  state: state,
  mutations: mutations,
  actions: actions,
  plugins: [pathify.plugin]
});

export default store;
